import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '@/views/index.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'indexPage',
        component: index
    },
    {
        path: '/courseDetail/:id',
        name: 'courseDetail',
        component: () => import(/* webpackChunkName: "about" */ '@/views/courseDetail.vue')
    },
    // 用户中西
    {
        path: '/userPage/one',
        name: 'onePage',
        component: () => import(/* webpackChunkName: "about" */ '@/views/userPage/onePage.vue')
    },
    {
        path: '/userPage/:two',
        name: 'twoPage',
        component: () => import(/* webpackChunkName: "about" */ '@/views/userPage/twoPage.vue')
    },
    {
        path: '/searchPage',
        name: 'searchPage',
        component: () => import(/* webpackChunkName: "about" */ '@/views/searchPage.vue')
    },
    // {
    //   path: '/about',
    //   name: 'about',
    //   // route level code-splitting
    //   // this generates a separate chunk (about.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
    // }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
